Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mpd-parser

Package Overview
Dependencies
Maintainers
15
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mpd-parser

mpd parser

  • 0.16.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
457K
increased by0.12%
Maintainers
15
Weekly downloads
 
Created

What is mpd-parser?

The mpd-parser npm package is used to parse MPEG-DASH (Dynamic Adaptive Streaming over HTTP) MPD (Media Presentation Description) files. It provides tools to read and interpret the structure and content of MPD files, which are XML-based manifests that describe media content and how it should be streamed.

What are mpd-parser's main functionalities?

Parsing MPD files

This feature allows you to parse an MPD XML string into a JavaScript object. The code sample demonstrates how to use the `mpd-parser` package to parse a simple MPD XML string and log the resulting JavaScript object.

const mpdParser = require('mpd-parser');
const mpdXml = '<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" type="static" mediaPresentationDuration="PT0H4M40.414S" minBufferTime="PT1.500S"><Period><AdaptationSet mimeType="video/mp4" codecs="avc1.4d401e" width="640" height="360" frameRate="30" startWithSAP="1" segmentAlignment="true"><Representation id="1" bandwidth="500000"><BaseURL>video/</BaseURL><SegmentList timescale="1000" duration="2000"><SegmentURL media="segment1.m4s" /><SegmentURL media="segment2.m4s" /></SegmentList></Representation></AdaptationSet></Period></MPD>';
const parsedManifest = mpdParser.parse(mpdXml);
console.log(parsedManifest);

Generating MPD files

This feature allows you to generate an MPD XML string from a JavaScript object. The code sample demonstrates how to use the `mpd-parser` package to convert a JavaScript object representing an MPD manifest into an XML string.

const mpdParser = require('mpd-parser');
const manifestObject = {
  type: 'static',
  mediaPresentationDuration: 'PT0H4M40.414S',
  minBufferTime: 'PT1.500S',
  periods: [
    {
      adaptationSets: [
        {
          mimeType: 'video/mp4',
          codecs: 'avc1.4d401e',
          width: 640,
          height: 360,
          frameRate: 30,
          startWithSAP: 1,
          segmentAlignment: true,
          representations: [
            {
              id: '1',
              bandwidth: 500000,
              baseURL: 'video/',
              segmentList: {
                timescale: 1000,
                duration: 2000,
                segmentURLs: [
                  { media: 'segment1.m4s' },
                  { media: 'segment2.m4s' }
                ]
              }
            }
          ]
        }
      ]
    }
  ]
};
const mpdXml = mpdParser.generate(manifestObject);
console.log(mpdXml);

Other packages similar to mpd-parser

Keywords

FAQs

Package last updated on 26 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc